import type { EChartsOption } from "echarts";
import * as echarts from 'echarts/core'
import mapData from '../../assets/map.json'
import addressData from '../assets/address.json'

echarts.registerMap('map',mapData as any)
export function getOption(): EChartsOption {
  return {
    tooltip: { // 窗口外框
      backgroundColor: 'rgba(0,0,0,0)',
      trigger: 'item',
    },
    title: {
      show: true,
      left: "center",
      text: "",
      textStyle: {
        color: "#2980b9",
        fontSize: 16
      }
    },
    legend: {
      show: false,
    },
    geo: {
      map: 'map',
      show: false,
      roam: false,
      itemStyle: {
        borderColor: 'rgba(13, 110, 191, 0)',
        borderWidth: 5,
        shadowColor: 'rgba(13, 110, 191, 0)',
        shadowOffsetX: 6,
        shadowOffsetY: 12
      }
    },
    series: [{
      tooltip: { // 显示的窗口
        show:false,
      },
      name: 'map',
      type: 'map',
      map: 'map', // 自定义扩展图表类型
      zoom: 1, //缩放
      showLegendSymbol: false,

      itemStyle: {  //地图样式
        borderColor: 'rgb(178,75,126)',
        borderWidth: 3,
        areaColor: {
          type: 'radial',
          x: 0.5,
          y: 0.5,
          r: 0.8,
          colorStops: [{
            offset: 0,
            color: 'rgba(147, 235, 248, 0)' // 0% 处的颜色
          }, {
            offset: 1,
            color: 'rgba(147, 235, 248, 0)' // 100% 处的颜色
          }],
        },
        shadowColor: 'rgba(4, 231, 205, 1)',
        shadowOffsetX: -5,
        shadowOffsetY: 5,
        shadowBlur: 10,
      },
      emphasis: { //鼠标移入动态的时候显示的默认样式
        disabled:true
      },
      layoutCenter: ['50%', '50%'],
      layoutSize: '100%',
      markPoint: {
        symbol: 'none'
      },
    },{
      type: 'scatter',
      name:'aaaa',
      tooltip:{
        textStyle: {
          color:'#ffffff',
          fontSize:18,
          lineHeight: 56,
        },
        formatter: function (params:any) {
          console.log(params)
          return params.data.address;
        },
      },
      label:{
        show:true,
        offset:[0,25],
        color:'#ffffff',
        fontSize: 16,
        formatter(params){
          return params.name
        }
      },
      coordinateSystem: 'geo',
      symbol: 'image://',
      symbolSize: [20, 20],
      data:addressData,
      itemStyle: {
        color: function (val) {
          return '#00ffe0';
        },
      },
    },
    ]
  }
}
